package com.xuecheng.content.convert;

import com.xuecheng.api.content.model.dto.CourseBaseDTO;
import com.xuecheng.api.content.model.vo.CourseAuditVO;
import com.xuecheng.api.content.model.vo.CourseBaseVO;
import com.xuecheng.content.entity.CourseBase;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * <p></p>
 *
 * @Description:
 */
@Mapper
public interface CourseBaseConvert {

    CourseBaseConvert INSTANCE = Mappers.getMapper(CourseBaseConvert.class);

    //将po转化为dto对象
    @Mapping(source = "id", target = "courseBaseId")
    CourseBaseDTO entity2dto(CourseBase courseBase);

    //将dto对象转为po对象
    @Mapping(source = "courseBaseId", target = "id")
    CourseBase dto2entity(CourseBaseDTO dto);

    //将vo对象转为dto对象
    CourseBaseDTO vo2dto(CourseBaseVO vo);


    CourseBaseDTO vo2Auditdto(CourseAuditVO vo);

    /*将pos转为dtos对象
     * PS：mapstruct对于list数据转换要依赖于单个数据转换的方法
     *    entitys2dtos 使用前必须要声明出 entity2dto
     * */
    List<CourseBaseDTO> entitys2dtos(List<CourseBase> courseBases);
}
